package acceptanceTests.writingAmessage;

import junit.framework.TestCase;
import acceptanceTests.registration.RegistrationInt;
import acceptanceTests.registration.RegistrationProxy;

public class WritingAmessageStoryTest extends TestCase{

	RegistrationInt _forumRegimp = new RegistrationProxy();
	WritingAmessageInt _writeMessage = new WritingAmessageProxy(_forumRegimp.getServer());

	public WritingAmessageStoryTest(String name) {
		super(name);
	}

	public void testWrite(){
		_forumRegimp.register("user1","abc@gmail.com", "password");
		Object tTopic2 = _writeMessage.getLegalTopicForNewMessage("user1");
		System.out.println("topic: " + tTopic2.toString());
		Object tMessage = _writeMessage.writeNewMessageReturnsMessage("ravitMessage3", "this is boring2", tTopic2, "user1");
		
		assertTrue(tMessage!=null);
		assertTrue(tTopic2.toString().equals( _writeMessage.getMessageTopic(tMessage).toString()));

		assertTrue( _forumRegimp.deleteRegisterUser("user1") );


	}

}
